package com.zcy.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;
/**
 * 
* <p>Title: BodyTag</p>
* <p>Description:一般用于处理修改标签体中的知识 </p>
* <p>Company: zcy</p> 
* @author Administrator
* @date 2016-8-24 上午10:47:10
 */
public class BodyTag extends BodyTagSupport {
	
	private BodyContent bodyContent;
	
	@Override
	public void setBodyContent(BodyContent b) {
		this.bodyContent=b;
		super.setBodyContent(b);
	}

	@Override
	public int doEndTag() throws JspException {
		String string = bodyContent.getString();
		System.out.println("前台的数据为:"+string);
		String newStr="哈哈，我是标签处理类中出来的";
		JspWriter jspWriter = bodyContent.getEnclosingWriter();
		try {
			jspWriter.write(newStr);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return EVAL_PAGE;
	}


}
